<?php

namespace Modules\Chinadmin\Models;


use Illuminate\Support\Facades\DB;

/**
 *
 */
class ArticleClassificationModel extends BaseModel
{

    public $table = 'ca_article_classification';
    public $primaryKey = 'id';


    static public function get_kv(){

        $data = self::where("p_id",0)->get();
        $kv[0] = '一级';
        if(!empty($data)){
            foreach($data as $k=>$v){
                $kv[$v['id']] = $v['name'];
            }
        }
        return $kv;

    }

    static public function getKva(){

        $data = self::where("grade",2)->get();
        $kv = [];
        if(!empty($data)){
            foreach($data as $k=>$v){
                $kv[$v['id']] = $v['name'];
            }
        }
        return $kv;

    }


}
